[PHP]日付の加算減算
現在日付からの日付計算
//1日前
strtotime(“-1 day”);
//1週間後
strtotime(“+1 week”);
//1か月前
strtotime(“-1 month”);
//1年後
strtotime(“+1 year”);
日付を文字列変換
//1日前 ‘2017-05-24’
date(“Y-m-d”, strtotime(“-1 day”));
//1年後 ‘2018-05-24’
date(“Y-m-d”, strtotime(“+1 year”));
//1か月前の1日
date(“Y-m-01”, strtotime(“-1 month”));
//1か月後の末日
echo date(‘Y-m-t’, strtotime(date(‘Y-m-01′).’+1 month’));
Fatal error: Allowed memory size of 209715200 bytes exhausted (tried to allocate 6292184 bytes) in /home/avanju/avanju.com/public_html/system/wp/wp-includes/class-walker-comment.php on line 196